package cn.wolfcode.restful.util;

public class JsonResult {
    private int code = 200;//状态: 200 成功 500 失败
    private String msg;
    private Object date;

    public JsonResult() {
    }
    public JsonResult(int code, String msg, Object date) {
        this.code = code;
        this.msg = msg;
        this.date = date;
    }

    public static JsonResult success(){
        return new JsonResult(200,"操作成功",null);
    }

    public static JsonResult success(Object data){
        return new JsonResult(200,"操作成功",data);
    }

    public static JsonResult error(){
        return new JsonResult(500,"失败",null);
    }

    public static JsonResult error(Object data){
        return new JsonResult(500,"失败",data);
    }
}
